//    Copyright (C) Kherty.  All rights reserved.
using System.ComponentModel;
using System.Diagnostics.Contracts;
using System.Reflection;
using OpenLS.Core.Notification;

namespace OpenLS.Spreadsheet.UI
{
    public class DocumentContainer : ViewModelBase
    {
        private SpreadsheetDocument _document;
        private bool _isVisible = true;

        public DocumentContainer(SpreadsheetDocument doc)
        {
            _document = doc;
        }

        public DocumentContainer()
        {
        }

        public bool IsVisible
        {
            get { return _isVisible; }
            set
            {
                _isVisible = value;
                notifyPropertyChanged("IsVisible");
            }
        }

        public string Name
        {
            get
            {
                if (_document == null) return "";
                return _document.Name;
            }
        }

        private bool _wasDirty;
        public void GetIsDirty()
        {
            _wasDirty = Document.IsDirty;
        }
        public void ResetIsDirty()
        {
            Document.IsDirty = _wasDirty;
        }

        public SpreadsheetDocument Document
        {
            get { return _document; }
            set
            {
                _document = value;
                notifyPropertyChanged("Document");
                notifyPropertyChanged("Name");
            }
        }
    }
}